package base.utils

import android.content.Context
import android.media.MediaScannerConnection
import android.net.Uri
import java.io.File

/**
 * Created by Administrator on 2017/10/25.
 */
class SingleMediaScanner(var context: Context, var mFile: File?) : MediaScannerConnection.MediaScannerConnectionClient {

    var mMs: MediaScannerConnection? = null

    init {
        mMs = MediaScannerConnection(context, this)
    }

    override fun onMediaScannerConnected() {
        mMs?.scanFile(mFile?.absolutePath, null)
    }

    override fun onScanCompleted(p0: String?, p1: Uri?) {
        mMs?.disconnect()
    }
}